import { Component, OnInit, Input } from '@angular/core';
import { FormControl } from '@angular/forms';

import { SelectItem } from '../shared/select-item.model';
import { MaterialColorConfig } from '../../../configs/colors/material-color/material-color.config';

@Component({
    selector: 'op-select',
    templateUrl: './material-select.component.html'
})
export class MaterialSelectComponent implements OnInit {
    @Input() isRequired: boolean;
    @Input() labelTitle: string;
    @Input() reactiveFormControl: FormControl;
    @Input() allItems: SelectItem[];
    @Input() color: string;

    constructor() { }

    ngOnInit(): void {
        this.initializeProperties();
    }

    protected initializeProperties(): void {
        this.isRequired = this.isRequired || false;
        this.color = this.color || MaterialColorConfig.basic;
    }
}